package org.dllwh.utils.apache.poi.word.conf;

import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * 把今天最好的表现当作明天最新的起点．．～
 * <p>
 * Today the best performance as tomorrow the newest starter!
 *
 * @ClassName ChineseFontSize
 * @Description 中文字号到磅值的映射
 * @Date 2025-11-20 17:29
 * @版本 V 1.0.1
 * @since JDK 17
 */
public enum ChineseFontSize {
    CHU("初号", 42),
    XIAOCHU("小初", 36),
    YI("一号", 26),
    XIAOYI("小一", 24),
    ER("二号", 22),
    XIAOER("小二", 18),
    SAN("三号", 16),
    XIAOSAN("小三", 15),
    SI("四号", 14),
    XIAOSI("小四", 12),
    WU("五号", 10.5),
    XIAOWU("小五", 9),
    LIU("六号", 7.5),
    XIAOLIU("小六", 6.5),
    QI("七号", 5.5),
    BA("八号", 5);

    private final String name;
    @Getter
    private final double points;

    ChineseFontSize(String name, double points) {
        this.name = name;
        this.points = points;
    }

    private static final Map<String, Double> NAME_TO_POINTS = new HashMap<>();

    static {
        for (ChineseFontSize size : values()) {
            NAME_TO_POINTS.put(size.name, size.points);
        }
    }

    public static Double getPoints(String chineseSize) {
        // 默认返回小四号
        return NAME_TO_POINTS.getOrDefault(chineseSize, 12d);
    }
}
